<template>
  <div class="tabdetial">
    <Nav></Nav>
    <div class="banner-wrap">
      <img class="banner" :src="tabdetailBg" />
    </div>
    <div class="wrap">
        <div
          @click="goToDetail(item.id)"
          v-for="item in info"
          :key="item"
          class="history-item"
        >
          <img :src="item.coverimage" />
          <div class="history-item-left">
            <div class="title">{{ item.title }}</div>
            <div class="subtitle">地点：{{ item.city }}</div>
            <div class="subtitle">专业：{{ item.subtitle }}</div>
          </div>
        </div>


        <div class="page">
        <van-pagination
            v-model="currentPage"
            @change="changePage"
            :total-items="total"
            force-ellipses
            />
    </div>
  

    </div>
     <div  class="pop" :class="{poptransform:showPop==1,poptransformNone:showPop == 0} ">
      <span @click="close" class="close"></span>
     </div>


    <Footer></Footer>

  </div>
</template>

<script setup>
import Footer from '../../components/pc/Footer.vue';
import Nav from '../../components/pc/nav.vue';
import { onMounted, ref } from 'vue';
import tabdetailBg from '../../assets/pc/newTestPc-bg.png';
let showPop = ref(-1)
import { useRoute, useRouter } from 'vue-router';
const route = useRoute();
let list = JSON.parse(decodeURIComponent(route.query.list));
console.log(list);
const router = useRouter();
const goToDetail = () => {
  showPop.value = 1
};
let info = ref({});
const changePage = () => {
  initList()
};
onMounted(async () => {
  initList()

});

//分页参数
const currentPage = ref(1)
let total = ref('')
let limit = ref(10)

const initList = async ()=>{
  // 获取列表数据
  total.value = list.length;
  info.value = []
  info.value = list.slice(limit.value * (currentPage.value - 1),limit.value * (currentPage.value - 1) + (limit.value));
}

const close = ()=>{
  showPop.value = 0
}
</script>

<style lang="less" scoped>
.tabdetial {
 .page {
        display: flex;
        align-items: flex-end;
        justify-content:flex-end;
        margin-top: 50Px;
    }
.pop {
    position: fixed;
    top:50%;
    z-index: 9999;
    left: 50%;
    transform: translate(-50%,-50%);
    width:900Px;
    height:500Px;
    background-image: url('../../assets/pc/pop.jpg');
    background-size: 100%;
    background-repeat: no-repeat;
    opacity: 0;
    z-index: -1;
    .close {
      position: absolute;
      right: 30Px;
      top: 0Px;
      width: 100Px;
      height: 80Px;
      cursor: pointer;
    }
}
.poptransformNone {
   animation: myfirst1 0.5s;
}
.poptransform {
   animation: myfirst 0.5s;
   animation-fill-mode: forwards;
}
@keyframes myfirst
{
    from {transform: translate(-50%,-40%); opacity: 0; z-index: -1;}
    to {transform: translate(-50%,-50%); opacity: 1;z-index: 10;}
}
@keyframes myfirst1
{   
    from {transform: translate(-50%,-50%); opacity: 1;z-index: 10;}
    to{transform: translate(-50%,-40%); opacity: 0;z-index: -1;}
}
  .wrap {
    position: relative;
    width: 1201Px;
    margin: 0 auto;
      .tabs {
    margin-top: 40Px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    .tabs-title {
      display: flex;
      align-items: center;
      font-size: 28Px;
      font-family: PingFangSC-Medium, PingFang SC;
      font-weight: 500;
      color: #666666;
      line-height: 40Px;
      margin-bottom: 3Px;
      span {
        width: 12Px;
        height: 12Px;
        background: #d8d8d8;
        border-radius: 12Px;
        margin: 0 32Px;
      }
    }
    .tabs-subTitle {
      font-size: 22Px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #999999;
      line-height: 30Px;
      margin-bottom: 37Px;
    }
  }
  }
  .banner-wrap {
    position: relative;
    width: 100vw;
    height: auto;
  }
  .banner {
    width: 100vw;
    height: auto;
    margin-bottom: 30Px;
  }
 
  .history-item {
    cursor: pointer;
    margin-top: 31Px;
    padding: 0 46Px;
    display: flex;
    align-items: center;
    height: 133Px;
    background-image: url('../../assets/pc/recommend-bg.jpg');
    background-size: 1200Px 133Px;
    background-repeat: no-repeat; 
    img {
      width: 100Px;
      height: 100Px;
      margin-right: 35Px;
    }
    .history-item-left {
      .title {
       font-size: 27Px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: #333333;
        line-height: 37Px;
        margin-bottom: 6Px;
      }
      .subtitle {
        font-size: 18Px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #868686;
        line-height: 25Px;
        margin-bottom: 3Px;
      }
    }
  }


}
</style>
